package com.zhuangxiaoyan.helloworld.proxy;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @Classname LogAspect
 * @Description TODO
 * @Date 2022/5/1 17:32
 * @Created by xjl
 */
@Aspect
@Component
public class LogAspect {

    @Pointcut("execution(public * com.zhuangxiaoyan.helloworld.proxy..*.*(..))*")
    public void pointCut(){};

    @Before("pointCut()")
    public void logStart(){
        System.out.println("查询之前打印日志....");
    }

    @After("pointCut()")
    public void logEnd(){
        System.out.println("查询之后打印日志....");
    }

    @AfterReturning("pointCut()")
    public void logReturn(){
        System.out.println("查询之后正常返回....");
    }

    @AfterThrowing("pointCut()")
    public void logException(){
        System.out.println("查询之后返回异常....");
    }
}
